<?php

/**
 * Projet filter form base class.
 *
 * @package    kc_report_proto
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseProjetFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'rma_id'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prj_libelle'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prj_date_debut'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'prj_date_fin'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'prj_date_copil_ancien'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'prj_date_copil_prochain' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'prj_commentaire'         => new sfWidgetFormFilterInput(),
      'prj_charge_total_jh'     => new sfWidgetFormFilterInput(),
      'prj_charge_cons_jh'      => new sfWidgetFormFilterInput(),
      'prj_charge_raf_jh'       => new sfWidgetFormFilterInput(),
      'prj_mantis_id'           => new sfWidgetFormFilterInput(),
      'prj_filtre_sp_mantis_id' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'rma_id'                  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'prj_libelle'             => new sfValidatorPass(array('required' => false)),
      'prj_date_debut'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'prj_date_fin'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'prj_date_copil_ancien'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'prj_date_copil_prochain' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'prj_commentaire'         => new sfValidatorPass(array('required' => false)),
      'prj_charge_total_jh'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prj_charge_cons_jh'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prj_charge_raf_jh'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prj_mantis_id'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'prj_filtre_sp_mantis_id' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('projet_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Projet';
  }

  public function getFields()
  {
    return array(
      'prj_id'                  => 'Number',
      'rma_id'                  => 'Number',
      'prj_libelle'             => 'Text',
      'prj_date_debut'          => 'Date',
      'prj_date_fin'            => 'Date',
      'prj_date_copil_ancien'   => 'Date',
      'prj_date_copil_prochain' => 'Date',
      'prj_commentaire'         => 'Text',
      'prj_charge_total_jh'     => 'Number',
      'prj_charge_cons_jh'      => 'Number',
      'prj_charge_raf_jh'       => 'Number',
      'prj_mantis_id'           => 'Number',
      'prj_filtre_sp_mantis_id' => 'Text',
    );
  }
}
